<?php
/**
 * Created by PhpStorm.
 * User: 张华杰
 * Date: 10/28/17
 * Time: 4:47 PM
 */

namespace app\models;

use Yii;
use yii\behaviors\BlameableBehavior;
use yii\behaviors\TimestampBehavior;
use yii\db\Expression;

/**
 * Class BaseModel
 * @package app\models
 */
class BaseModel extends \yii\db\ActiveRecord
{
    public function behaviors()
    {
        return [
            //以下三行代码，使model能自动写入插入更新时间，插入更新的操作者id
            [
                'class' => TimestampBehavior::className(),
                'value' => new Expression('NOW()'),
            ],
            BlameableBehavior::className(),
        ];
    }
}